import request from '@/utils/request';

// 获取云存储临时密钥
export function OSS_STS() {
    return request({
        url: '/getSTS',
        method: 'GET',
    });
}
// 获取验证码
export function getVerifyCodeAPI({ type, phone, email }) {
    if (!type) {
        return console.error('没有设置验证码类型');
    }
    const baseUrl = type === 'phone' ? '/send/sms' : '/send/email';
    return request({
        url: baseUrl,
        method: 'post',
        data: { phone, email },
    });
}
// 验证手机号或邮箱是否已被使用
export function verifySignCanUse({ type, phone, email }) {
    if (!type) {
        return console.error('没有设置类型');
    }
    const baseUrl = type === 'phone' ? '/testPhone' : '/testEmail';
    return request({
        url: baseUrl,
        method: 'post',
        data: { phone, email },
    });
}
